package cn.yunyichina.provider.logs;

import cn.yunyichina.provider.logs.thread.TestMdc;
import cn.yunyichina.provider.logs.thread.TestMdc2;
import cn.yunyichina.utils.log.Log;
import cn.yunyichina.utils.log.constant.LogScene;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Lullaby on 2017/5/9.
 */
public class LogApp {

    private static Logger logger = LoggerFactory.getLogger(LogApp.class);

    private static final String CONFIGURATION = "applicationContext.xml";

    public static InheritableThreadLocal<Long> number=new InheritableThreadLocal<>();

    public static void main(String[] args) {
//        MDC.put("traceId","my-test111111999999999999999999999999999999999999999999999");


        number.set(100L);

        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(CONFIGURATION);
        applicationContext.start();
        Log.i(LogScene.BED,"我测试traceId");

        TestMdc t1=new TestMdc();
        Thread thread1=new Thread(t1);
        thread1.start();

//        try {
//            Thread.sleep(5000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//
        TestMdc t2=new TestMdc();
        Thread thread2=new Thread(t2);
        thread2.start();


        logger.info("************* yyt-provider-logs service started *************");
        com.alibaba.dubbo.container.Main.main(args);
    }
}
